$json = Get-Content "$(Get-Location)/Config/AppSettings.json" | ConvertFrom-Json

# 读取当前版本号
$currentVersion = $json.Version

# 拆分版本号
$versionParts = $currentVersion -split '\.'
$major = [int]$versionParts[0]
$minor = [int]$versionParts[1]
$build = [int]$versionParts[2]
$revision = [int]$versionParts[3]

# 递增修订号
# $revision++

# 更新版本号
$newVersion = "$major.$minor.$build.$revision"

# 将新版本号写入Version.txt
# Set-Content $versionFilePath $newVersion

# 更新项目文件中的版本号属性
$projectFilePath = "DataChangeTools.csproj"  # 请将此行替换为你的实际项目文件名
$projectFileContent = Get-Content $projectFilePath
$updatedProjectFileContent = $projectFileContent -replace '<Version>.*<\/Version>', "<Version>$newVersion</Version>"
$updatedProjectFileContent = $updatedProjectFileContent -replace '<FileVersion>.*<\/FileVersion>', "<FileVersion>$newVersion</FileVersion>"
$updatedProjectFileContent = $updatedProjectFileContent -replace '<AssemblyVersion>.*<\/AssemblyVersion>', "<AssemblyVersion>$newVersion</AssemblyVersion>"
Set-Content $projectFilePath $updatedProjectFileContent



